#include <stdio.h>
#include <stdlib.h>
#include <time.h>


void ShellSort(int A[],int n){
    int d,i,j,t=1;
    for(d=n/2;d>=1;d=d/2){
        for(t=1;t<=d;t++){
            for(i=t;i<=n;i=i+d){
                if(i-d<1)
                    continue;
                A[0] = A[i];
                for(j=i-d;j>0&A[j]>A[0];j=j-d){
                    A[j+d]=A[j];
                }
                A[j+d]=A[0];	
            }
        }
	}
}


int main(){
	//int A[11]={0,49,38,65,97,76,13,27,49,1,10};
    srand(time(NULL));
	int A[11];
	int i;
	for(i=1;i<11;i++){
		A[i]=rand()+rand()-rand();
	}
	ShellSort(A,10);
	for(i=1;i<10;i++){
		printf("%d ",A[i]);
	}
} 